package demo1;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Random;

public class gather {
    public static String [] color={"♥","♠","♦","♣"};
    public static void buygather(List<card> gather1){
        for (int i = 0; i < 4; i++) {
            for (int j = 1; j < 14; j++) {
                gather1.add(new card(j,color[i]));
            }
        }
    }
    public static void washgather(List<card> gather1){
        Random random=new Random();
        for (int i = gather1.size()-1; i >0 ; i--) {
            Collections.swap(gather1,i,random.nextInt(i));
        }
    }
    public static List<List<card>> dealcards(List<card> gather1){
        List<List<card>> user=new ArrayList<>();
        user.add(new ArrayList<>());
        user.add(new ArrayList<>());
        user.add(new ArrayList<>());
        for (int i = 0; i < 5; i++) {
            for (int j = 0; j < 3; j++) {
                user.get(j).add(gather1.get(0));
                gather1.remove(0);
            }
        }
        return user;
    }
}
